package com.hyt.it.ogt.kq.common.enums;

import cn.hutool.core.util.NumberUtil;
import lombok.Getter;

/**
 * 考试协议枚举
 */
@Getter
public enum ExamAgreementEnum {

    NONE(0, "未知"),
    EXAM_NOTICE(1, "考生须知"),
    WELCOME_WORDS(2, "欢迎语"),
    ;

    public final int code;

    public final String desc;

    ExamAgreementEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }


    public static String getDescByCode(Integer code) {
        for (ExamAgreementEnum bl : ExamAgreementEnum.values()) {
            if (NumberUtil.equals(bl.getCode(), code)) {
                return bl.getDesc();
            }
        }
        return "";
    }

    public static ExamAgreementEnum getEnumByCode(Integer code) {
        for (ExamAgreementEnum bl : ExamAgreementEnum.values()) {
            if (NumberUtil.equals(bl.getCode(), code)) {
                return bl;
            }
        }
        return NONE;
    }
}
